import math

# a = [1, 2, 3, 4]
# print(a[int(1.9)])

# a = "0123456789"
# print(a[9:9])
# a += "1"
# print(a)

# a = {1: 2, 3: 4}
# print(set())

# print("\u00b3)")
# direction = (2 < 1)
# print(direction)

# a = set([1, 2, 0])
# a.remove(2)
# # a.pop()
# print(a)
# print(abs(-1))

# print(str(bin(10)))
# a = [1,1,1,2]
# a.remove(1)
# print(a)

# a = [1, 2, 3].pop(-1)
# print(type([]))
# print(type([]) == list)

# print(5 in [1, 5])
# print(2 ** 32)
# if None:
#     print(1)
# import copy
# a = [[1, 2], [3, [4, 5]]]
# b = copy.deepcopy(a)
# b[1][1][1] = 6
# print(b)
# print(a)
# print([1] in [1,2])
# print(type(8/2))
# print(1//2)
# print({1:2, 3:4} == {3:4, 1:2})
# print(5000/13800000000)
# print(set("210"))
# hash([1])
# {[1]:2}
# TypeError: unhashable type: 'list'

# print(list({1: 2, 3: 4}.values()))
# a = [[11, 12], [1, 2], [3, 4], [100, 200, 300]]
# a.sort()
# print(a)
# print(math.factorial(5))
# print([1,2,3][-3])
# print(float(53e4))
# print("".join(["1", "2", "3"]))
# print(bin(0b1011 + 0b1010))
# a = eval("0b1010")
# print(type(a))
# print("0b1011")
# print(bin(100), oct(100), hex(100))
# print("/../".split("/"))
# print("/".join(["a", "b", "c"]))
# [].index(2)
# print([{} for i in range(5)])

# print([1, 2, 3].)
# import re
# result = re.match("<([a-zA-Z0-9]+)><([a-zA-Z0-9]+)>.*?</\\2></\\1>",
#                   "<html><h1>asdbj</h1></html><html><h1>asdbj</h1></html><html><h1>asdbj</h1></html>")
# print(result.group())
# # href="index.php?page=post&amp;s=view&amp;id=4709265
# result = re.match("span id=",
#                   '<div class="thumbnail-preview"><span id="s4709263" class="thumb"><a id=')
# print(result.group())
# from collections import defaultdict
# mem = defaultdict(int)
# print(mem)
# mem[1] += 1
# print(mem)
# # a = {}
# # a[2] += 1
# # print(a)
# print(float('inf'))
# for i in range(-5, -1):
#     print(i)
# import re
# a = re.match("12(?P<a>345)6", "1234567890")
# print(a.group())
# print(a.group("a"))
# print(list(set([-9,-9,-9,-8,-8,-7,-7,-7,-7,-6,-6,-6,-6,-6,-6,-6,-6,-6,-5,-5,-5,-5,-5,-4,-4,-4,-3,-3,-3,-3,-3,-3,-2,-2,
#        -2,-2,-2,-2,-2,-2,-2,-2,-1,-1,-1,-1,-1,-1,0,0,0,1,1,2,2,2,2,2,2,2,3,3,3,3,4,4,4,4,4,5,5,5,5,5,5,5,6,6,6
#           ,7,7,7,7,7,8,9,9,9,10,10,10,10,10,10,10,-10,-9,-9,-9,-9])))
# print("".join([1, 2, 3]))
# print("123111".replace("1", "4", 1))
# print([1, 2] * 7)
# a = [1, 2]
# print(a + [3])
# print(a)
# hash([1])
# {[1]: 1}
# print(float('inf'))
# print("0123141")
# print([1]+[2])
# a = [1, 2, 3]
# # b = [2, 4]
# # print(set(a)+set(b))
# a = {1, 2, 3}
# b = {2, 4}
# a = a | b
# a = a + b
# a |= b
# print(a)
# print([1, 2, 3] != -1)
# a = set()
# print(type(a))
# def set_ch(a, b):
#     a |= b
# set_ch(a, b)
# print(a)
# a.update(b)
# print(a)
# print("%s" % {1: 2})
# print(b'0' * 10)

# for a in range(b'1111'):
#     print(a)
# def a(*args, **kwargs):
#     print(args)
#     print(kwargs)
#
# b = {"a":2, "b":4}
# c = [1, 3, 4]
# a(*c, **b)
#
# print("012345678"[:11])
# import copy
# a = "12331sdfa"
# print(id(a))
# b = copy.deepcopy(a)
# print(id(b))
# var = {"$id": "1", "neighbors":
#     [{"$id": "2", "neighbors": [{"$ref": "1"}, {"$id": "3", "neighbors": [{"$ref": "2"},
#                                                                           {"$id": "4",
#                                                                          "neighbors": [{"$ref": "3"}, {"$ref": "1"}],
#                                                                            "val": 4}], "val": 3}], "val": 2},
#      {"$ref": "4"}], "val": 1}
# print(type(var))
# print("-11")
# print(1.5 // -1)
# for i in range(10):
#     print(bin(i))
# print(7 // 2)
# a = {5, 1, 2, 3, 4}.pop()
# print(a)
# print([1, 2, 3] - [2])
# a = 257
# b = 257
# print(a is b)
# class A(object):
#     pass
#
# a = A()
# b = A()
# print(a == b)
# print(a is b)
# print(bool([]))

# a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
# a[2::2] = [0] * len(a[2::2])
# print(a)
#
# {1, 2, 3}.remove(3)
# a = {1}
# a.update([1, 2])
# print(a.pop())
# print(a)
# a.remove(3)
# print({1, 2, 3}[-1])
# a = {1, 2, 3}
# for i in a:
#     print(i)
# print("bbbbbbb".count("bbbbb"))
# print(set("dasfas"))
# print(len({1, 2, 3, 4}))
# [1, 2, 3, 4].remove(5)
# a = [[2, 9, 10], [3, 7, 15], [5, 12, 12], [15, 20, 10], [19, 24, 8]]
# a.sort(key=lambda lists: lists[2], reverse=True)
# print(a)
# print(-1//2)
# redis-trib.rb create --replicas 1 192.168.33.141:7000 192.168.33.141:7001 192.168.33.141:7002 192.168.33.141:7003 192.168.33.141:7004 192.168.33.141:7005
# print(32 * 21 * 14)
# a = ["3+456*23+74-9+0","3+456*23+74-9-0","34*56-2-3+7490"]
# for lists in a:
#     print(eval(lists))
# print(type("sdfsadf")
# print(type("sdfsadf") == type('str'))
# import sys
# try:
#     eval("(())()")
# except Exception as e:
#     b = sys.exc_info()
#     print(b)
#     print(b[1].offset)

# print([1, 2, 3, 4] - [2, 4])
# for i in range(2, 1):
#     print(i)
# print("a" < "b")
# print("0" < "a")
# print(set("dsafsdf"))
# print(b"10111" & b"01001")
# print(len([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
#      1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
#      1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2].count(2))
# # [].pop()
# a = b = c = 1
# a = [[5, 9], [4, 8], [8, 9], [5, 1], [2, 5], [9, 0], [1, 5], [5, 0], [8, 2], [6, 0], [7, 5], [0, 5], [5, 7], [7, 4],
#      [0, 9], [9, 5], [5, 2]]
# b = [[0, 5], [0, 9], [9, 0], [5, 0], [1, 5], [5, 1], [2, 5], [8, 2], [5, 2], [4, 3], [7, 4], [4, 8], [6, 0], [7, 5],
#      [5, 7], [8, 9], [9, 5], [5, 9]]
# a = [[5, 9], [4, 8], [8, 9], [5, 1], [2, 5], [9, 0], [1, 5], [5, 0], [8, 2], [6, 0], [7, 5], [0, 5], [5, 7], [7, 4], [4, 3], [0, 9], [9, 5], [5, 2]]
# print([lists for lists in b if lists not in a])
# print(2 >> 1)
# print(float("-inf") +1)
# {1, 2, 3}.remove(4)
# print(len("\r\n"))
# print(bin(5))
# "".startswith()
# print(set("123132"))
# print("aaabbb".split("b"))
# a = {1, 2}
# print(a.copy().add(3))
# print(a)
# import re

# print(re.search(r"https?://.*?/", "http://www.xicidaili.com/nn/1").group())
# print(bin(1022))
# print(re.findall(r"((?P<name1>.)(?P=name1)+)", "*" * 10 + "a" + "*" * 10))
# print(len("aaaabbaaabbaaa123456A"))
# print((3, 2) < ("a", "b"))
# print(' abc' > 'xyz')
# print(3 > 2 > 2)
# # print(5+5j > 2-3j)
# print(ascii("a"), ascii('A'), ascii(1))
# a, b = 52 * 5, 65 * 4
# c, d = (a - 100), (b - 100)
# print(a is b, c is d)
# a, b = 260, 260
# print(a is b)

# a = [i for i in range(10)]
# a = [i + 1 for i in a]
# print(a)

from collections import defaultdict


def check_word(input1: str, input2: str):
    word_dic = defaultdict(int)
    for i in input1:
        word_dic[i] += 1
    for j in input2:
        if word_dic[j] > 0:
            word_dic[j] -= 1
        else:
            return False
    return True



